/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package asa;

/**
 *
 * @author Mickael
 */
public class ASAExprAnd extends ASAExpr {

    private ASAExpr e1;
    private ASAExpr e2;

    public ASAExprAnd(ASAExpr e1, ASAExpr e2) {
        this.e1 = e1;
        this.e2 = e2;
    }
    @Override
    public ASAExpr getExpr1() {
        return e1;
    }

    @Override
    public ASAExpr getExpr2() {
        return e2;
    }
    @Override
    public int evalue() {
        //return e1.evalue() + e2.evalue();
        int res1 = e1.evalue();
        boolean bool1, bool2;
        int res2 = e2.evalue();
        if (res1 == 0) {
            bool1 = false;
        } else {
            bool1 = true;
        }
        if (res2 == 0) {
            bool2 = false;
        } else {
            bool2 = true;
        }
        if (bool1 && bool2) {
            return 1;
        } else {
            return 0;
        }

    }

    @Override
    public String getLabelExplorateur() {
        return "AND";
    }
}
